package com.ahtcm.tcmlearning.utils.brushProblem;

import java.text.NumberFormat;

public class RateUtil {
    //计算记忆斩学习进度
    public static  String learningRate(int  totalNumber,int completed){
        NumberFormat numberFormat = NumberFormat.getInstance();
        // 设置精确到小数点后2位
        numberFormat.setMaximumFractionDigits(0);
        float res = (float) completed / (float) totalNumber * 100;
        if (res>100){
            String rate = "100%";
            return rate;
        }
        String rate = numberFormat.format(res) + "%";
        return  rate;

    }
}